home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 36
/
PC Gamer IT CD 36 2-2.iso
/
VIGDEMO
/
data1.cab
/
Assets
/
scripts
/
endgame.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
3KB
|
607 lines
int Initialize(string dummy)
{
global int gState;
global real gStartTime;
global real gEndTime ;
global string gNextLevel = "";
global string gSameLevel = "";
global int hasfraglimit;
global int gStartSound = 45;
global int gProgressSound = 36;
global int gEndSound = 45;
Reset("dummy");
}
int Reset(string dummy)
{
gState = 0;
gEndTime = -1.0;
hasfraglimit = 0;
SetCollidableProperties(thisObject,0,0);
SetStyle(thisObject,1);
IgnoreCollision(thisObject);
wakeupTime = -1.0;
gStartTime = GetTime(thisObject);
}
int startsound(string soundname)
{
gStartSound = GetSoundIndex(soundname);
}
int endsound(string soundname)
{
gEndSound = GetSoundIndex(soundname);
}
int progresssound(string soundname)
{
gProgressSound = GetSoundIndex(soundname);
}
int nextlevel(string level)
{
gNextLevel = level;
}
int setfraglimit(string str)
{
gFragLimit = Str2Int(str);
wakeupTime = 0.1;
return 0;
}
int setendtime(string str)
{
real time = GetTime(thisObject);
gEndTime = Str2Real(str);;
wakeupTime = time + gEndTime;
}
int nextlevel(string level)
{
gNextLevel = level;
}
int Colliders(int size)
{
real value;
int index;
map::iterator ix;
map::iterator iy;
map objInList;
objInList = Collisions(thisObject,0,1,0);
ix = begin(objInList);
iy = end(objInList);
if (ix != iy) {
if (gState == 1) {
value = UnitRandom();
if (value > .5)
index = GetBrainVOSoundIndex("VOEND1");
else
index = GetBrainVOSoundIndex("VOEND2");
if (ix != iy)
{
PlayVoiceOver(index);
}
wakeupTime = GetTime(thisObject) + 5.0;
}
else
{
GCOMMAND("endfail");
}
}
IgnoreCollision(thisObject);
}
int start(string msg)
{
if (gState == 0)
{
if (StringCompare(msg,"success") == 0)
{
gState = 1;
}
else if (StringCompare(msg,"failure") == 0)
{
gState = 2;
GCOMMAND("endfail");
}
}
if (StringCompare(msg,"quit") == 0)
{
if (gState == 1)
{
gState = 1;
TimedEvent(0);
} else
{
gState = 2;
TimedEvent(0);
}
}
}
int TimedEvent(int input)
{
if (gState == 1)
{
GCOMMAND("endwin");
} else if (gState == 2)
{
GCOMMAND("endlost");
}
wakeupTime = -1.0;
return 0;
}